package com.jumi.microservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jumi.microservice.dto.afterseal.AfterSaleGoodsInfo;
import com.jumi.microservice.entity.AfterSealOrder;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author scw
 * @date 2020/9/24
 */
@Mapper
public interface AfterSealOrderMapper extends BaseMapper<AfterSealOrder> {
    /**
     * 批量更新包裹号
     *
     * @param list
     * @return
     */
    @Update("<script><foreach collection='list' item='item' index='index' open='' close='' separator=';'>" +
            "UPDATE after_seal_order SET real_logistics_no = #{item.realLogisticsNo},express_company = #{item.expressCompany},confirm_time = ADDDATE(NOW(),8),order_status = 3 ,remark = #{item.remark}" +
            " where id = #{item.id} and order_status = 2" +
            "</foreach></script>")
    int batchUpdateAfterOrder(List<AfterSealOrder> list);

    /**
     * 批量更新包裹号
     *
     * @param list
     * @return
     */
    @Update("<script><foreach collection='list' item='item' index='index' open='' close='' separator=';'>" +
            "UPDATE after_seal_order SET real_logistics_no = #{item.realLogisticsNo},express_company = #{item.expressCompany},confirm_time = ADDDATE(NOW(),8),order_status = 3 " +
            " where order_no = #{item.orderNo} and order_status = 2" +
            "</foreach></script>")
    int batchUpdateAfterOrderByOrderNo(List<AfterSealOrder> list);
}
